/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { responseSuccess } from '../utils';
import Mock from 'mockjs';
const { mock } = Mock;

export default {
  'POST /invoice/transferData': (req: Request, res: Response) => {
    const data = mock({
      'result|1-5': [
        {
          id: '@id',
          index_shop_id: '@id',
          index_shop_name: '西藏拉萨公司',
          shop_info_id: '@id',
          invoice_title: '西藏拉萨申通',
          taxpayer_unionid: '@id',
          'transfer_money|1-100.1-10': 1,
          transfer_no: '@id',
          admin_commnet: '备注2',
          'status|1': ['0'], // ['0', '1', '-1'],
          invoice_status: '0',
          created_at: '@now',
        },
      ],
    });
    res.send({
      code: '0',
      msg: 'success',
      data: {
        ...data,
        total: data.result.length,
      },
    });
  },
  'POST /invoice/dowExcel': (req: Request, res: Response) => {
    res.send({
      code: 0,
      msg: 'success',
      data: 'http://upload.kuaidihelp.com/admin/bond/csv/2021/12/保证金管理数据导出_20211229154844.csv',
    });
  },
  'POST /invoice/transferUpdate': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /invoice/getShopInfo': (req: Request, res: Response) => {
    res.send(
      mock({
        code: '0',
        msg: 'success',
        data: {
          id: '280',
          index_shop_id: '990',
          invoice_title: '西藏拉萨申通',
          taxpayer_unionid: '850000',
          bank_name: '农业银行',
          bank_account: '850000',
          company_address: '西藏拉萨',
          contact: '850000',
          license_url:
            'http://upload.kuaidihelp.com/wdadmin/shop_invoice_info/s_990/990_20191218144953.jpg',
          qualification_url:
            'http://upload.kuaidihelp.com/wdadmin/shop_invoice_info/s_990/990_20191218145005.png',
          type: '1',
          created_at: '2019-12-18 14:50:08',
          license_name: '990_20191218144953.jpg',
          qualification_name: '990_20191218145005.png',
        },
      }),
    );
  },

  'POST /invoice/openInvoiceList': (req: Request, res: Response) => {
    const { status = '1' } = req.body;
    const data = mock({
      'list|1-5': [
        {
          id: '@id',
          create_time: '@now',
          account: '@phone',
          app_id: '101060',
          invoice_title: '快宝（上海）网络技术有限公司',
          company_tax_number: '@id',
          bank_name: '@county(true)' + '***银行',
          bank_account: '@id',
          phone: '@phone',
          company_address: '@county(true)',
          company_office_number: '@phone',
          bank_log_id: '123456789',
          'money|1-100.1-10': 1,
          'pay_type|1': ['银行转帐', '支付宝', '微信'],
          'api_name|1': ['物流查询', '地址清晰'],
          'buy_row|1': ['10.00元/5000次', '20.00元/1000次'],
          'type|1': ['专用发票', '普通发票'],
          'email|1': ['', '10269780@qq.com'],
          receiver_name: '@cname',
          receiver_phone: '@phone',
          receiver_address: '上海市上海市******',
          status,
          status_invoice: status,
          reason: '备注',
          order_id: '158331246010854',
          taxpayer_unionid: '564387903',
          company_phone: '@phone',
        },
      ],
    });
    res.send({
      code: '0',
      msg: 'success',
      data: {
        ...data,
        count: data.list.length,
      },
    });
  },
  'POST /invoice/openInvoiceEdit': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /invoice/openInvoiceRechargeStatusEdit': (req: Request, res: Response) =>
    responseSuccess(req, res),
};
